Storing and Retrieving a WatchList
Using script, it is possible to store the list of points in a WatchList object for retrieval the next time the screen is open.
The following example simplifies the concept by using a Load and a Save button, which store and retrieve the list from the Dictionary object, respectively. WatchList data can also be stored on the file system or in another database format with the ImportFromXml and ExportToXml methods.
To Store and Retrieve a WatchList
- Create a new Studio screen.
- Add a WatchList object and two Button objects to the View. Name the WatchList control "watchList" and the two buttons "btnLoad" and "btnSave." Set the Text properties of these buttons to "Load List" and "Save List." Set the [ButtonType] property for both buttons to Standard.
- Add script to the Save button.
- Open the Script Editor and navigate to btnSave EventClick event.
- Enter the following script to save the WatchList’s current list to the Dictionary object under "WatchList."
Copy
Save the WatchList
Sub btnSave_EventClick()
Dim This : Set This = btnSave
Dictionary.Value("WatchList") = watchList.ExportToXml
End Sub
- Add script to the Save and Load buttons.
- Navigate to btnLoad EventClick event.
- Enter the following script to load the WatchList from the Dictionary object. The Boolean parameter in ImportFromXml determines whether or not duplicate points will be replaced from the stored XML.
Copy
Load the WatchList
Sub btnLoad_EventClick()
Dim This : Set This = btnLoad
watchList.Clear
watchList.ImportFromXml Dictionary.Value("WatchList"), True
End Sub
- Save the screen and switch to Run mode. Add points to the WatchList by right-clicking the list and selecting Add Point.

